package com.qf.mq;

import com.qf.service.DocService;
import com.qianfeng.smsplatform.common.constants.RabbitMqConsants;
import com.qianfeng.smsplatform.common.model.Standard_Submit;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;

/*
 * @Data: 2021/7/22 21:11
 * */
@Component
public class ReceiveLogListener {
    private DocService docService;
    @Autowired
    public void setDocService(DocService docService) {
        this.docService = docService;
    }

    @RabbitListener(queues = RabbitMqConsants.TOPIC_SMS_SEND_LOG)
    public void onMessage(Standard_Submit submit) throws IOException {
        System.out.println("来添加的监听日志了"+submit);
        docService.addDoc(submit);
    }

}
